﻿package com.d4p.util
{
	public class RandomUtil
	{
		/**
		 * start부터 end 사이의 실수를 반환하는 함수  
		 * @param start
		 * @param end
		 * @return 
		 * 
		 */		
		 
		static private var _randomIntInstance:RandomUtil;
		public function RandomUtil(singletonEnforcer:SingletonEnforcer){}
		
		public static function getrandomIntInstance():RandomUtil
		{
			if(RandomUtil._randomIntInstance == null){
				RandomUtil._randomIntInstance = new RandomUtil(new SingletonEnforcer());	
			}
			return RandomUtil._randomIntInstance;
		}
		 
		public function getRandomNumber( $start: Number, $end: Number ): Number 
		{			
			return  $start + ( $end - $start ) * Math.random();
		}		
		
		public function getRandomInt( $start: int, $end: int ): int
		{					
			return  Math.round( $start - 0.5 +  ( $end - $start + 1 ) * Math.random() ); 			
		}		
		
	}
}
class SingletonEnforcer{}